package com.kefu.chat.vo;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kefu.chat.model.ChatFaq;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractSearchVo;
import com.kefu.common.vo.AbstractUpdateVo;
import lombok.Data;

@Data
public class ChatFaqSearchVo extends AbstractSearchVo {
    private String faqName;

    @Override
    public LambdaQueryWrapper lambdaQuery() {
        LambdaQueryWrapper<ChatFaq> wrapper = Wrappers.lambdaQuery(ChatFaq.class);
        if (StrUtil.isNotBlank(faqName)) {
            wrapper.like(ChatFaq::getFaqName, faqName);
        }
        wrapper.eq(ChatFaq::getTenantId, KefuContext.getKefuContext().getTenantId());
        wrapper.orderByDesc(ChatFaq::getId);
        return wrapper;
    }
}
